#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

void ShellSort(int*arr, int n)
{
	int gap = 3;
	while (gap--)
	{
		for (int j = 0; j < gap; j++)
		{
			for (int i = j; i < n - gap; i += gap)
			{
				int end = i;
				int tmp = arr[end + gap];
				while (end >= 0)
				{
					if (tmp<arr[end])
					{
						arr[end + gap] = arr[end];
						end -= gap;
					}
					else
					{
						break;
					}
				}
				arr[end + gap] = tmp;
			}
		}
	}
	
}

int main()
{
	int arr[] = { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6 };
	ShellSort(arr, sizeof(arr) / sizeof(arr[0]));
	for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++)
	{
		printf("%d ", arr[i]);
	}
	printf("\n");
	return 0;
}